package com.zhongxi.guoyuan.adapter.personCenter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zhongxi.guoyuan.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/25.
 */

public class CollectViewpagerAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> fragment=new ArrayList<>();
    private String[] title;
    private Context context;

    public CollectViewpagerAdapter(FragmentManager fm,List<Fragment> fragment,String[] title,Context context ) {
        super(fm);
        this.fragment=fragment;
        this.title=title;
        this.context=context;
    }

    @Override
    public Fragment getItem(int position) {
        return fragment.get(position);
    }

    @Override
    public int getCount() {
        return fragment.size();
    }

//    @Override
//    public CharSequence getPageTitle(int position) {
//        return title[position];
//    }
    public View getTabview0(){
        View view=LayoutInflater.from(context).inflate(R.layout.item_text,null);
        TextView textView= (TextView) view.findViewById(R.id.tab_item_text);
        textView.setText(title[0]);
        return view;
    }
    public View getTabview1(){
        View view=LayoutInflater.from(context).inflate(R.layout.item_text,null);
        TextView textView= (TextView) view.findViewById(R.id.tab_item_text);
        textView.setText(title[1]);
        return view;
    }
}
